Variable contrast mapping of digital images

ABSTRACT

Processing of a pixel of a digital image includes mapping intensity of the pixel as a smooth, non-linear continuous function of the intensity and minimum and maximum intensities of a local pixel neighborhood of the pixel.

BACKGROUND

[0001] Image sharpening is performed to improve the appearance of digital images and particularly the legibility of documents. Most filters that perform image sharpening use variations of unsharp masking, a linear sharpening filter, which generates overshoots and undershoots at abrupt edges. Unsharp masking tends to produce visually favorable results for natural images, but not for document images. In images of documents, the unsharp masking can create overshoot artifacts, which reduce image compressibility of text-rich images.

[0002] An alternative to unsharp masking is based on the mathematical morphology approach, which is frequently reduced to combinations of neighborhood-minimum and neighborhood-maximum filters. Morphological filters that combine smoothing and sharpening, such as the Mean of Least Variance (MLV) filter and variants of toggle mapping filter, tend to strongly posterize images, i.e. reduce original images to piecewise constant intensity functions. While this effect can be desirable for purely textual images or medical images, it does not yield visually acceptable results for compound document images, which may also contain photos, variable backgrounds, and other image regions that do not correspond to piecewise constant intensity profiles.

SUMMARY

[0003] According to one aspect of the present invention, processing of a pixel of a digital image includes mapping intensity of the pixel as a smooth, non-linear continuous function of the intensity and minimum and maximum intensities of a local pixel neighborhood of the pixel. Other aspects and advantages of the present invention will become apparent from the following detailed description, taken in conjunction with the accompanying drawings, illustrating by way of example the principles of the present invention.

BRIEF DESCRIPTION OF THE DRAWINGS

[0004]FIG. 1 is an illustration of a digital image processing method in accordance with an embodiment of the present invention.

[0005]FIG. 2 is an illustration of an exemplary neighborhood of pixels for the method of FIG. 1.

[0006]FIG. 3 is an illustration of an exemplary non-linear function for the method of FIG. 1.

[0007]FIG. 4 is an illustration of a profile of a contrast-stretching parameter.

[0008]FIG. 5 is an illustration of another exemplary non-linear function for the method of FIG. 1.

[0009]FIG. 6 is an illustration of a digital imaging system including a machine for performing the method of FIG. 1.

DETAILED DESCRIPTION

[0010] Reference is made to FIG. 1, which illustrates a method of performing variable contrast mapping on a grayscale digital image. The variable contrast mapping is performed on a pixel-by-pixel basis. On each pixel of interest, the variable contrast mapping includes determining minimum and maximum intensity values and a local contrast range of a local pixel neighborhood (110); and mapping intensity of the pixel of interest as a smooth, non-linear continuous function of its intensity value, and the minimum and maximum intensity values (120). The mapped value remains within the local contrast range. This non-linear function will be referred to as a “contrast mapping function.”

[0011] The local contrast range (D) of a pixel of interest may be determined as difference between the corresponding minimum intensity value (m) and the corresponding maximum intensity value (M). Thus D=M−m. This range (D) can vary from pixel to pixel.

[0012] An exemplary local neighborhood is illustrated in FIG. 2. The exemplary local neighborhood is delineated by a window indicated in dashed lines. Preferably, the neighborhood should be symmetric about the pixel of interest (the pixel of interest in FIG. 2 is marked with an “X”). A 3×3 local neighborhood is illustrated; however, the local neighborhood is not limited to any particular size or shape. The size and shape of the local neighborhood may even be changed dynamically to accommodate a particular class of image region (e.g., text, graphics, natural features). At boundary pixels and other pixels having partial neighborhoods, local minima and maxima of the partial neighborhoods may be used.

[0013] The middle of the local contrast range (the “mid-range point”) is one-half the sum of the local maximum and local minimum. That is, the mid-range point A=(M+m)/2.

[0014] The local neighborhood may include the pixel of interest, or it may be punctured. A punctured neighborhood does not include the pixel of interest. The punctured neighborhood might be preferred for images containing halftone noise.

[0015] If the neighborhood is punctured, the value of the pixel of interest may be clipped to ensure that the value of the pixel of interest does not exceed the local maximum or fall below the local minimum (115). If the value of the pixel of interest is greater than the local maximum, the value is set equal to the local maximum. If the value of the pixel of interest is less than the local minimum, the value is set equal to the local minimum.

[0016] The contrast mapping function may include a contrast-stretching parameter λ(D), which is a function of the local contrast range (D). The contrast stretching parameter λ(D) affects the slope of the non-linear function at the mid-range point. A contrast mapping function F_(λ)(I) having a sigmoid shape and a slope of 1+λ is illustrated in FIG. 3. The effects of λ=0, λ=−0.7, and λ=0.7 are illustrated in FIG. 3. For this example, the contrast mapping function F_(λ)(I) performs identity mapping for λ=0, contrast compaction for λ<0, and contrast stretching for λ>0. Thus the sign of the contrast stretching parameter (λ) determines whether contrast stretching or contrast compaction is performed, and the value of the contrast stretching parameter determines the amount of contrast stretching or contrast compaction. A negative value of the contrast stretching parameter can cause contrast compaction by pushing a pixel intensity value toward the mid-range point, and a positive value can cause contrast stretching by the pushing pixel intensity value away from the mid-range point.

[0017] The contrast-stretching parameter λ(D) is a continuous, non-decreasing function of the local contrast range. It may have the following general characteristics. As D→0, λ→−λ₀, which corresponds to maximum contrast compaction. For 0<D<T₁ (low contrast ranges), contrast compaction is performed as a non-decreasing function of D. For T₀≦D≦T₁, λ(D)=0, whereby identity mapping is performed. For T₁<D<T_(MAX) (high contrast ranges), contrast mapping is performed as a non-decreasing function of D. The threshold T_(MAX) corresponds to very strong edges. Maximum contrast mapping (λ=λ_(MAX)) is performed at D=T_(MAX). For D>T_(MAX), contrast mapping is performed at λ=λ_(MAX) to prevent oversharpening of edges.

[0018] An exemplary profile for the contrast stretching parameter λ(D) is shown in FIG. 4. The exemplary contrast-stretching parameter λ has a piecewise-linear profile. Contrast compaction increases linearly from −λ₀ to 0 over the range D=0 to D=T₀. The range D=T₀ to D=T₁ shrinks to a single point, where identity mapping is performed (λ=0). Contrast stretching increases linearly from λ(T₀)=0 to λ(T_(MAX))=λ_(MAX). Contrast stretching is performed at λ=λ_(MAX) for D>T_(MAX).

[0019] The contrast mapping function F_(λ)(I) has the following constraints: (1) it is non-decreasing; (2) it produces filtered values that cover the entire local contrast range; and (3) it is symmetrical with respect to lightening and darkening about the mid-range point so that it identity-maps a pixel at its mid-range point. Because of constraints (1) and (2), the local minimum and local maximum values (m and M) are mapped to themselves. The non-linear function F_(λ)(I) can perform clipping in addition to the clipping that might have been performed at step 115.

[0020] A generic expression for such a function F_(λ)(I) may take the following form: ${F_{\lambda}(I)} = \left\{ \begin{matrix} {I > {M:}} & M \\ {{{I - A}} \leq {\frac{1}{2}{D:}}} & {\min \left\{ {M,{\max \left\lbrack {m,{I + {\lambda \cdot {K(I)}}}} \right\rbrack}} \right\}} \\ {I < {m:}} & m \end{matrix} \right.$

[0021] where I represents pixel intensity, and K(I) denotes a contrast stretching term, which depends parametrically upon M,m and complies with the following constraints:

[0022] (a1) vanishes at three points: K(m)=K(M)=K(A)=0.

[0023] (a2) has the same sign as I−A: sgn(K(I))=sgn(I−A).

[0024] (a3) has unity derivative at I=A: K′(A)=1.

[0025] Following constraint (a3), the derivative of F_(λ)(I) at the mid-range point (A) is 1+λ.

[0026] The function K(I) may be expressed as a cubic polynomial in I, which is proportional to a product derived from the constraint (a1). ${K(I)} = \frac{\left( {I - A} \right) \cdot \left( {M - 1} \right) \cdot \left( {I - m} \right)}{\left( {\frac{1}{2}D} \right)^{2}}$

[0027] Other functions with similar properties could be used. For example, the contrast stretching term could take the following form. ${K(I)} = {\frac{D}{2\pi} \cdot {{\sin \left( {2{\pi \cdot \frac{I - A}{D}}} \right)}.}}$

[0028] The variable contrast mapping can adaptively perform contrast stretching and contrast compaction without creating artifacts. Strong contrast stretching is applied to strong edges (e.g., computer-generated features, text) mild contrast stretching to mild edges (e.g., edges in natural features), and contrast compaction in low contrast neighborhoods (e.g., patches that do not contain edges).

[0029] The variable contrast mapping sharpens edges without enhancing low amplitude noise. Halftone noise is not enhanced, and can even be partly smoothed. Overshoot is prevented. Consequently, compressibility of the contrast-mapped image is not reduced relative to the original image, and can even be increased.

[0030] The variable contrast mapping can be modified to perform “selective thickening” of narrow, dark features such as lines and text. The selective thickening may be performed to compensate for a psycho-visual effect that results from excessive contrast stretching and other types of sharpening. The excessive contrast stretching appears to make narrow dark features thinner at normal viewing distance, since the human eye is more sensitive to the lighter side of a dark feature. Thus sharpened, narrow, dark features appear thinner at normal viewing distance, even though they really aren't thinner. The selective thickening can be used to make the narrow dark features bolder and appear to have the correct thickness at normal viewing distance.

[0031] The modified contrast mapping function F_(λ,t)(I) complies with the same first and second constraints as the function F_(λ)(I) above: (1) non-decreasing; and (2) producing filtered values that cover the entire local contrast range. However, the modified contrast mapping function F_(λ,t)(I) complies with a third constraint that is generalized from F_(λ)(A)=A to F_(λ,t)(A_(t))=A, where the “lightened inverse mid-point” A_(t) is defined as A_(t)≡A+ΔA_(t), where ΔA_(t) is a prescribed horizontal shift of the mid-range. This horizontal mid-range shift ΔA_(t) is proportional to the contrast range. For example, ΔA_(t)=t·D/2 where t is a dimensionless thickening parameter.

[0032] A generic expression for such a function F_(λ,t)(I) may take the following form ${F_{\lambda,t}(I)} = \left\{ \begin{matrix} {I > {M:}} & M \\ {{{I - A}} \leq {\Delta \quad {A_{i}:}}} & {\min \left\{ {M,{\max \left\lbrack {m,{I + {\lambda \cdot {K_{t}(I)}} - {B_{t}(I)}}} \right\rbrack}} \right\}} \\ {I < {m:}} & m \end{matrix} \right.$

[0033] K_(t)(I) is a contrast stretching term, which complies with the following constraints:

[0034] (b1) vanishes at three points: K_(t)(m)=K_(t)(M)=K_(t)(A_(t))=0.

[0035] (b2) has the same sign as I−A_(t): sgn(K_(t)(I))=sgn(I−A_(t)).

[0036] (b3) has unity derivative at I=A: K′_(t)(A)=1.

[0037] B_(t)(I) is a boldening term which complies with the following constraints:

[0038] (c1) vanishes at the two end points: B_(t)(m)=B_(t)(M)=0

[0039] (c2) is non-negative: B_(t)(I)≧0

[0040] (c3) causes maximum boldening at I=A: B′_(t)(A)0

[0041] (c4) its derivative corresponds to the prescribed horizontal shift at I=A_(t): B′_(t)(A_(t))A_(t)−A=ΔA_(t)

[0042] The constraints (b₁) and (c₁) together ensure that the modified contrast mapping function F_(λ,t)(I) identity-maps the two end points. Constraints (b2) and (c2) together ensure that the modified contrast mapping function F_(λ,t)(I) is below the identity map (i.e. darkens) up to a value that is lighter than A_(t). Constraints (b3) and (c3) together cause the modified curve to have the same slope at the mid-range point A as the original curve, i.e. they are parallel at that point. Constraints (c4) and (b₁) ensure that the modified contrast mapping function F_(λ,t)(I) passes through the third constraining point F_(λ,t)(A_(t))=A.

[0043] Exemplary contrast stretching and boldening terms K_(t)(I),B,(I) are as follows: ${K_{t}(I)} = \frac{\left( {I - A_{t}} \right) \cdot \left( {M - 1} \right) \cdot \left( {I - m} \right)}{\left( \frac{D}{2} \right)^{2}}$ ${B_{t}(I)} = {\frac{t}{\left( {1 - t^{2}} \right)} \cdot \frac{\left( {M - I} \right) \cdot \left( {I - m} \right)}{\left( \frac{D}{2} \right)}}$

[0044]FIG. 5 illustrates the horizontal mid-range shift. Shown in solid is an exemplary unshifted contrast mapping function F_(λ)(I). Shown in dash is the exemplary modified contrast mapping function F_(λ,t)(I) for t=0.4. Because of the horizontal mid-range shift, the modified contrast mapping function F_(λ,t)(I) is not symmetrical with respect to lightening and darkening about A. A point lighter than the mid-range point by a prescribed amount (ΔA_(t)) is mapped to the mid-range point.

[0045] Because the shift is defined on the horizontal axis (and not the vertical axis), there is a correspondence between t and the geometric shift in the location of the mid-range point A at edges. The horizontal mid-range shift corresponds to thickening, not darkening. Among the advantages, a uniform value of t causes the same thickening to edges for different contrast ranges. The uniform value of the contrast mapping parameter t causes the most darkening on the light side of a strong edge, some darkening on the light side of a mild edge, and very little darkening in low contrast regions. Slight darkening in low contrast regions, if not desired, can be avoided by setting t=0 when D is less than a threshold.

[0046] The actual value of the selective thickening parameter is application-specific. A value for the selective thickening parameter (t) can be selected to allow more aggressive contrast stretching without thinning. However, this value can be increased so that the dark features appear even thicker, or this value can be decreased so that the dark features appear thinner, but not as thin as without selective thickening. Thus thinning may be undercompensated for values of t between 0 and t_(c) (where t=0 results in no thickening, and t=t_(c) results in compensative thickening), or thinning may be overcompensated for values t greater than t_(c).

[0047]FIG. 6 shows a digital imaging system 610. An image capture device 612 provides lines of a digital image to a processor 614. The processor 614 may store all of the lines of the digital image in memory 616 for processing at a later time, or it may process the digital image in real time. The processed image may also be stored in the memory 616. The processor 614 may use hardware, software or a combination of the two to process the digital image according to the method of FIG. 1. The processor may perform additional processing as well.

[0048] In a software implementation, the memory 616 stores a program that, when executed, instructs the processor 614 to perform the method of FIG. 1. The processor 614 and memory 616 may be part of a personal computer or workstation, they may be embedded in an image capture device, etc.

[0049] In both hardware and software implementations, the processing can be performed using only integer arithmetic and precomputed lookup table terms. Thus the variable contrast mapping can be implemented in a very efficient manner. Moreover, the variable contrast mapping can be performed in real time.

[0050] The variable contrast mapping is not limited to any particular type of image. It may be applied to images containing only text and other computer-generated features, images containing only natural features, and compound documents containing natural features and computer-generated features.

[0051] The variable contrast mapping may be “bootstrapped” onto another processing method that determines minimum and maximum pixel intensity values for neighborhoods of pixels. For example, the variable contrast mapping may be bootstrapped onto the bleed through reduction method disclosed in assignee's U.S. Ser. No. ______ (attorney docket no. PDNO 200309934-1).

[0052] Thus far the variable contrast mapping has been described with respect to a grayscale digital image. However, the variable contrast mapping can be extended to color images. In perceptual color space, where luminance is decoupled from chrominance (e.g., YC_(r)C_(b), YUV, Lab), the variable contrast mapping may be applied to the luminance channel. Conventional sharpening may be used on the chrominance channels. However, the sharpening of the chrominance channels is optional, since the human visual system is less sensitive to chrominance than luminance.

[0053] The variable contrast mapping may be performed on multiple channels, wherein the contrast-stretching parameter is coordinated between the multiple channels. As a first example, the variable contrast mapping may be used to sharpen or smooth the chrominance channels in addition to the luminance channel. The pixel values of each chrominance channel are converted to chrominance intensities (in YC_(b)C_(r) color space, for example, the chromatic intensity of a pixel may be computed as C={square root}{square root over (C_(b) ²+C_(r) ²)}). A local contrast range of chrominance intensities is computed for each pixel in each chrominance channel. The contrast stretching parameter that was used to map the luminance component of a pixel is also used to map the chrominance components of that pixel, but as a function of the local contrast range of chrominance intensities.

[0054] As a second example, the image is initially in a non-perceptual color space such as RGB (in which luminance and chrominance are not decoupled). For each pixel, the luminance component is computed and mapped, and the difference between the original value and the mapped luminance value is determined. That difference is used to modify each component in non-perceptual color space. For example, the RGB triplet of a pixel is [100, 150, 200]. If the luminance is reduced by 50 gray levels, the RGB value may be modified by reducing each component by 50 gray levels to [50, 100, 150]. In the alternative, the RGB components may be multiplied by the ratio of mapped luminance to original luminance. Clipping may be applied to the resulting pixel values to ensure that the RGB results of the transformed image are within the RGB gamut. A more sophisticated gamut mapping may be performed instead of clipping to maintain color fidelity.

[0055] As a third example, the variable contrast mapping may be applied to each channel in RGB color space. For each pixel, local contrast range and a contrast-stretching parameter are determined for each color component, and a single contrast-stretching parameter is selected. That single contrast-stretching parameter is used to map each color component of the pixel. The single parameter used in the mapping may be a linear combination of the three individual parameters, the maximum of the three parameters, etc. Use of the single parameter can avoid color fringes.

[0056] The selective thickening is not limited to filters that perform variable contrast mapping. Unsharp masking filters and other sharpening filters can be modified to perform selective thickening. These filters may be modified to perform more sharpening of dark features at darks sides of edges. The resulting imbalance between the dark and light sides of an edge creates the perception of a shift in location of the edge center, which results in the perception of a thicker, darker edge. The selective boldening may be performed as a non-decreasing function of local contrast.

[0057] Consider a linear unsharp masking (sharpening) filter that has the form F_(ζ)(I)=I+ζ·(I−L), where ζ is a sharpening factor, and L is the result of applying a spatial low-pass filter with its center located on the pixel of interest. Such a filter can perform s elective thickening simply by shifting the argument by ΔA_(t), where t is the dimensionless thickening parameter. Thus the linear sharpening filter modified to perform selective thickening may have the form F_(ζ,t)(I)=I−ΔA_(t)+ζ·(I−ΔA_(t)−L).

[0058] In this more general application, ΔAt may be proportional to the spatial gradient of the intensity (I), wherein ΔA_(t)=t·|ΔI|=t·{square root}{square root over ((∂_(x)I)²+(∂_(y)I)²)}. According to this definition for ΔA_(t), the selective darkening is very small, even negligible, in low-contrast (low-gradient) neighborhoods. Using this definition for ΔA_(t), the parameter t retains its meaning for the geometric shift of the edge center, as with variable contrast mapping.

[0059] In addition to making ΔA_(t) depend on the gradient, the sharpening factor can also depend on the gradient in order to avoid sharpening of noise in low-gradient neighborhoods, which is also analogous to variable contrast mapping (λ(|ΔI|) instead of ζ(D)). However, the selective sharpening is independent of the thickening.

[0060] Selective thickening can be applied without performing sharpening by setting the sharpening factor ζ to ζ=0. Thus F_(t)(I)=I−t·|ΔI|. This holds true for variable contrast mapping, where λ(D)=0.

[0061] The present invention is not limited to the specific embodiments described and illustrated above. Instead, the invention is construed according to the claims that follow. 

1. A method of processing a pixel of a digital image, the method comprising mapping intensity of the pixel as a smooth, non-linear continuous function of the intensity and minimum and maximum intensities of a local pixel neighborhood of the pixel.
 2. The method of claim 1, wherein the pixel is mapped as a function of local contrast range of the local neighborhood.
 3. The method of claim 2, wherein the neighborhood is punctured; and wherein the method further includes clipping the pixel if the pixel lies outside of the local contrast range.
 4. The method of claim 2, wherein the mapping is also performed as a function of a contrast-stretching parameter, the contrast stretching parameter determining whether the pixel is mapped by contrast stretching, contrast compaction, or identity mapping.
 5. The method of claim 4, wherein the contrast stretching parameter determines the slope of the mapping function at a mid-range point.
 6. The method of claim 4, wherein contrast compaction is performed for local pixel neighborhoods with small local contrast ranges, and contrast stretching is performed for local pixel neighborhoods with high local contrast ranges.
 7. The method of claim 4, wherein contrast stretching does not exceed a prescribed value for high contrast neighborhoods.
 8. The method of claim 4, wherein the contrast-stretching parameter is a continuous, non-decreasing function of the local contrast range
 9. The method of claim 4, wherein the mapping function has the form: ${F_{\lambda}(I)} = \left\{ \begin{matrix} {I > {M:}} & M \\ {{{I - A}} \leq {\frac{1}{2}{D:}}} & {\min \left\{ {M,{\max \left\lbrack {m,{I + {\lambda \cdot {K(I)}}}} \right\rbrack}} \right\}} \\ {I < {m:}} & m \end{matrix} \right.$


10. The method of claim 1, wherein the mapping function is non-decreasing, it produces filtered values that cover the entire local contrast range, and it is symmetrical about a mid-range point with respect to lightening and darkening so that the function identity-maps at the mid-range point.
 11. The method of claim 1, wherein the mapping function also allows for selective thickening of dark features.
 12. The method of claim 11, wherein the mapping function is non-decreasing; produces filtered values that do not exceed the local contrast range, and identity-maps the minimum and maximum values; and (3) maps a point lighter than a mid-range point by a prescribed amount to the mid-range point.
 13. The method of claim 11, wherein the mapping is a function of local contrast range and a selective thickening parameter, the selective thickening parameter causing a central horizontal shift of the mapping function, the shift proportional to the thickening parameter and the local contrast.
 14. The method of claim 13, wherein the mapping function has the general form ${F_{\lambda,t}(I)} = \left\{ \begin{matrix} {I > {M:}} & M \\ {{{I - A}} \leq {\Delta \quad {A_{i}:}}} & {\min \left\{ {M,{\max \left\lbrack {m,{I + {\lambda \cdot {K_{t}(I)}} - {B_{t}(I)}}} \right\rbrack}} \right\}} \\ {I < {m:}} & m \end{matrix} \right.$


15. The method of claim 1, wherein the digital image is a color image; and wherein the mapping is performed on a luminance component of the color image.
 16. The method of claim 1, wherein the digital image is a color image; wherein the mapping is performed on multiple channels of the color image, and wherein the contrast-stretching parameter is coordinated between the multiple channels.
 17. Apparatus for processing a plurality of pixels of a digital image, the apparatus comprising a processor for mapping intensity of each one of the pixels as a smooth, non-linear continuous function of pixel intensity and local minimum and maximum intensities.
 18. A system comprising: a capture device for generating a digital image; and a processor for processing a plurality of pixels of the digital image by mapping intensity of each one of the pixels as a smooth, non-linear continuous function of pixel intensity and local minimum and maximum intensities.
 19. An article for a processor, the article comprising computer memory encoded with a program for instructing the processor to process a pixel of the digital image by mapping intensity of the pixel as a smooth, non-linear continuous function of pixel intensity and local minimum and maximum intensities. 